On The Education Front
By Grant Kwai
Copyright (c) 1994 Apple Users' Group, Sydney
Republished from Applecations, a publication of the Apple Users' Group, Sydney, Australia.
Welcome to the third article in this series. This month we move onto the senior school subject of Chemistry. One of the things you need to know in this subject is the periodic table.
What is a periodic table? A periodic table is a way of showing all the elements known to man and show their similarities and differences. All matter is made up from these elements; from your car to your body. They are the basic building blocks of life.
Below is a little program to help you see how well you know the Symbols for several different elements. Teachers or students can then run the program and attempt to guess the correct answer. The computer will verify your answer. Changes to the elements can be made by altering the data lines at the end of the program. Make sure that if you do make any modifications, that you also modify the corresponding symbol type as well.
I have created a variance in the level of difficulty for this program; Easy, average and hard. If you want, you can later modify this to add more levels.
Each level consist of ten questions and when done, the computer will give you the number of correct answers you gave.
Listing 1
---------
]NEW
1 REM ==============================
2 REM = This is a Freeware program =
3 REM = Please give it to all your =
4 REM = friends. 1990 =
5 REM ==============================
10 DIM A$(30);DIM B$(30);DIM C$(1)
20 DIM R$(1)
30 FOR D=1 TO 30: READ A$(D) : NEXT D
40 FOR E=1 TO 30: READ B$(E) : NEXT E
100 HOME
110 PRINT "SYMBOLS AND ELEMENTS QUIZ"
120 PRINT "-------------------------"
130 PRINT
140 PRINT " BY GRANT KWAI "
150 PRINT
160 PRINT "WHAT LEVEL WOULD YOU LIKE?":
PRINT "(1) EASY","(2) AVERAGE","(3)HARD"
170 INPUT A
180 IF A=3 THEN GOTO 600
190 IF A>3 THEN GOTO 100
200 IF A<1 THEN GOTO 100
210 B = A * 10
220 M = B - 9
230 Z=0
240 FOR T=M TO B
300 PRINT: PRINT"WHAT IS THE SYMBOL FOR ";A$(T)
310 INPUT C$
320 IF C$ = B$(T) THEN 350
330 PRINT "THAT IS WRONG. THE CORRECT ANSWER IS ";B$(T)
340 GOTO 390
350 Z = Z + 1
360 PRINT "THAT IS CORRECT!"
370 FOR W=1 TO 800 : NEXT W
380 HOME: PRINT : PRINT
390 NEXT T
400 PRINT "YOU HAVE NOW ANSWERED 10 QUESTIONS" :
PRINT "YOUR SCORE WAS ";Z;"
OUT OF 10"
410 IF Z > 8 THEN PRINT "PRETTY GOOD GOING. YOU ARE A REAL WIZ." : GOTO 500
430 IF Z < 6 THEN PRINT "A BIT MORE STUDY IS CALLED FOR." : GOTO 500
440 PRINT "FAIRLY AVERAGE. A BIT FOR STUDY WOULD BE BENEFICIAL."
500 PRINT : PRINT "DO YOU WANT TO TRY AGAIN?"
510 INPUT R$
520 IF R$="Y" THEN GOTO 100
530 PRINT "THE END" : END
600 Z = 0
610 FOR Y = 1 TO 10
620 X = INT(29 * RND(1) + 1)
630 PRINT "WHAT IS THE SYMBOL FOR ";A$(X): INPUT C$
640 IF C$= B$(X) THEN GOTO 670
650 PRINT : PRINT "THAT IS INCORRECT. THE ANSWER IS ";B$(X)
660 GOTO 690
670 PRINT "CORRECT!":Z = Z + 1
680 NEXT Y
690 GOTO 400
1000 DATA "HYDROGEN" ,"OXYGEN" ,"NITROGEN"
,"HELIUM" ,"CARBON" ,"SULFUR"
,"NEON" ,"LITHIUM" ,"MAGNESIUM" ,"BORON"
1010 DATA "SODIUM" ," CHLORINE" , "BARIUM"
,"IRON" , "URANIUM" ,"POTASSIUM"
,"PHOSPHORUS" , "LEAD" ,"GOLD" ,"SILVER"
1020 DATA "TIN" , "MERCURY" ,"OSMIUM"
,"COBALT" ,"GALLIUM" ,"TUNGSTEN"
,"ZIRCONIUM" ,"RHODIUM" ,"PLUTONIUM" ,"CALIFORNIUM"
2000 DATA "H","O","N","HE","C","S","NE","LI","MG","B"
2010 DATA "NA","CL","BA","FE","U","K","P","PB","AU","AG"
2020 DATA "SN","HG","OS","CO","GA","W","ZR","RH","PU","CF"
Explanation
-----------
Lines:
30-40 Finds data for variable D and E (Uses a loop, which continues 30 times); READs data into A$ and B$ DIMensions locations.
160-170 Asks question and INPUTs answer into variable A
180-200 Checks to see that 'A' is within questions limits.
210-230 Sets variables B, M and Z. 'B' is used for determining how much of the data should be used (eg if level is 2, only use the first 20 elements in the data). 'M' however sets the lower limit of the number of elements to
choose from. So, in the example, range would now be 11-20. 'Z' is the counter, so it starts at 0.
240 Sets minimum and maximum values for variable T.
300 Asks the question, uses data in A$(T) - the element.
310 Gets the answer.
320 Checks answer given with correct answer.
330 Since in line 320, they didn't match, answer in C$ must be wrong. Gives correct answer stored as B$(T).
350 Adds 1 to the correct Z value. Z is the number of answers correct. It can only be incremented on a correct answer as line 340 will force all wrong answers to jump to line 390.
390 Tells computer to go onto next value of T as long as T does NOT equal the B variable. If they do, then move onto the next line in the program, 400. When they are equal, it means 10 questions have been asked.
410-440 Gives an opinion as how you went. This is determined by what value of Z is currently stored. eg if you scored 9 out of 10, line 410 would be executed. 430 is executed if mark was less than 6, and 440 if mark is within 6-8. Upon executing of any of these lines, move onto line 500.
600 Resets value of Z to 0.(ie your score value). Note, all commands in the 600-690 are executed only for the hard level option (ie option 3)
610 Sets number of questions as Y, that is, 10.
620 randomises element choice(There are 30 elements). Stores value as X. Thus, question could come from any one of the 30 stored elements.
1000-1020 DATA of elements.
2000-2020 DATA of element symbols.
NOTE: It is possible to change and extend the number of elements for this quiz. Simply change the DIMensions in line 10, the range in lines 30-40, the '29' in line 620 to new dimensions minus one and finally extend the data lines.
You might also decide to make the elements 'case sensitive'. That is making symbols such as Gold as 'Au', instead of 'AU'. Perhaps adding a PRINT statement to warn students would be appropriate.

THIS CONTENT COPYRIGHT © 2007, APPLE MACINTOSH USERS' GROUP, SYDNEY
Permission has been obtained to make this material available on the Internet.

Permission is hereby granted for non-profit user groups to republish this content.
PLEASE CREDIT THE AUTHOR AND THE SOURCE: Applecations, publication of the Apple Users' Group, Sydney, Australia

THIS PAGE COPYRIGHT © 2007, ANDREW ROUGHAN